Skip to content

feat(py): pass pathlib.Path object directly without.read_text()#44

Merged
schloerke merged 12 commits into
mainfrom
feat-pathlib-str
Jul 1, 2025
Merged

feat(py): pass pathlib.Path object directly without.read_text()#44
schloerke merged 12 commits into
mainfrom
feat-pathlib-str

Conversation

@chendaniely

@chendaniely chendaniely commented Jun 26, 2025

Copy link
Copy Markdown
Contributor

quality of life improvement where querychat will .read_text() for you on a pathlib.Path object.

Currently failing a ruff/pyright check because of system_prompt_

    # Create the system prompt, or use the override
    system_prompt_ = system_prompt_override or system_prompt(
        data_source_obj,
        data_description_str,
        extra_instructions_str,
    )

    # Default chat function if none provided
    create_chat_callback = create_chat_callback or partial(
        chatlas.ChatOpenAI,
        model="gpt-4.1",
    )

    return QueryChatConfig(
        data_source=data_source_obj,
        system_prompt=system_prompt_, # HERE
        greeting=greeting_str,
        create_chat_callback=create_chat_callback,
    )
Argument of type "str | Path" cannot be assigned to parameter "system_prompt" of type "str" in function "__init__"
  Type "str | Path" is not assignable to type "str"
    "Path" is not assignable to "str"Pyright[reportArgumentType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportArgumentType)

@schloerke

Copy link
Copy Markdown
Contributor

All currently failing lints are passing in #37. Will wait for that to merge before merging this PR.

@schloerke

schloerke commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

@schloerke

Copy link
Copy Markdown
Contributor

Thank you!

@schloerke schloerke merged commit f838f16 into main Jul 1, 2025
16 checks passed
@schloerke schloerke deleted the feat-pathlib-str branch July 1, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants